---
title: Deploy your Astro Site to Space
description: How to build an Astro site in Space.
type: deploy
i18nReady: true
---
import InstallGuideTabGroup from '~/components/TabGroup/InstallGuideTabGroup.astro';
import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro'

[Deta Space](https://deta.space/developers) is a personal computer that lives in the cloud — a ‘personal cloud’. You can build and run apps for yourself in your own "Space". You can publish the apps you've built, and they'll run for people all around the world.

This guide includes step-by-step instructions for building sites in Space. Both static and server-side rendered (with the [`@astrojs/node` adapter](/en/guides/integrations-guide/node/)) Astro sites are supported.

:::note
The following instructions will not work for v3.0+ Astro projects as Space currently only [supports Node.js 16](https://deta.space/docs/en/build/quick-starts/node/).
:::

## Prerequisite

To push an Astro site to Space, make sure you first:

- Create a [Space account](https://deta.space).
- Install the [Space CLI](https://deta.space/docs/en/build/reference/cli) and log in.

Create a Space project **inside** the directory of your Astro project. Run the CLI and follow the instructions on the screen.    

```bash
space new
```

:::note
The Space CLI will try to auto-detect the configuration for your app. Accept the suggested configuration and then follow the instructions below, depending on the type of Astro app you want to deploy.
:::


## Project Configuration

### Static site

Make the following changes to the `Spacefile` file at the root of your project generated by the Space CLI. 
	
1. Change the engine to `static`.
2. Add Astro's build command to the list of `commands`.
3. Serve the `dist` directory generated by Astro. 

```yaml title="Spacefile" {6,8,9}
# Spacefile Docs: https://deta.space/docs/en/build/reference/spacefile
v: 0
micros:
  - name: static-astro-in-space
    src: .
    engine: static
    commands:
      - npm run build
    serve: dist
```

### Server-side rendered site


Make the following changes to the `Spacefile` file at the root of your project generated by the Space CLI:

1. Configure the `nodejs16` engine.
2. Add the `build` command.
3. Include the `dist` directory generated by Astro. 
4. Run the node command.

```yaml title="Spacefile" {6,8,10,11}
# Spacefile Docs: https://deta.space/docs/en/build/reference/spacefile
v: 0
micros:
  - name: ssr-astro-in-space
    src: .
    engine: nodejs16
    commands:
      - npm run build
    include:
      - dist
    run: "node ./dist/server/entry.mjs"
```

## How to deploy

Deploy your project with the following command:

```bash
space push
```

This will run the build process and create a new [Space app instance](https://deta.space/docs/en/build/fundamentals/development/builder-instance#for-testing) where you can access your Astro app.

By default Space apps are private and are only accessible to you. 

If you want to make your app available to others you can use [Public Routes](https://deta.space/docs/en/build/reference/spacefile#public_routes) to make parts of your app public. Or, you can [create a release](https://deta.space/docs/en/publish/releasing#releases) to let others install your app into their own personal cloud.

## Next steps

- [Add more compute to your Space project](https://deta.space/docs/en/build/fundamentals/the-space-runtime/micros#adding-a-micro)
- [Store data for your Space project](https://deta.space/docs/en/build/fundamentals/data-storage#content)
- [Launch your Space app](https://deta.space/docs/en/publish/releasing#releases)

## Examples

- [Astro in Space](https://github.com/BogDAAAMN/astro-in-space) – GitHub
